//
//  TopicMyGroupTableViewCell.swift
//  HoneyBee
//
//  Created by Smith_Yang on 2018/8/2.
//  Copyright © 2018 point. All rights reserved.
//

import UIKit

class TopicMyGroupTableViewCell: UITableViewCell {
    
    var topicGroup : TopicGroupModel?
    
    @IBOutlet weak var backgoupView: UIView!
    @IBOutlet weak var leadheadIcon: UIImageView!
    @IBOutlet weak var groupTitleLabel: UILabel!
    @IBOutlet weak var groupContentLabel: UILabel!
    @IBOutlet weak var groupTopicCount: UILabel!
    @IBOutlet weak var groupLeadLabel: UILabel!
    
    @IBOutlet weak var groupAdminFlag: UIImageView!
    
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        
        self.backgoupView.layer.cornerRadius = 2.0
        self.backgoupView.layer.masksToBounds = true
        self.backgroundColor = UIColor.clear
        self.groupAdminFlag.isHidden = true
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func configModel(model:TopicGroupModel , index:IndexPath) {
        self.topicGroup = model
        
        groupTitleLabel.text =  model.groupName
        groupContentLabel.text = model.remark
        groupTopicCount.text = String(format: "%d", model.topicNum)
        groupLeadLabel.text = model.groupLeader
        if (model.admin){
            self.groupAdminFlag.isHidden = false
        } else{
            self.groupAdminFlag.isHidden = true

        }
//        leadheadIcon.setImageWith(URL(fileURLWithPath: model.groupLeaderId), placeholderImage:
    }
    
}
